# 使用redis来做消息中间件
# 任务存储
# redis有密码的话
# result_backend = r'redis://:password@127.0.0.1:6379/0'
from settings import conf

broker_url = r'redis://{}:{}/0'.format(conf.REDIS_HOST, conf.REDIS_PORT)
# 结果存储
result_backend = r'redis://{}:{}/0'.format(conf.REDIS_HOST, conf.REDIS_PORT)

# 使用rebbitmq来做消息中间件
# 默认是使用guest账号来登录的
# broker_url = 'amqp://guest:guest@localhost:5672//'
# broker_url = 'amqp://admin:admin@192.168.10.1:5672//'

# result_serializer = 'json'
# 时区
timezone = 'Asia/Shanghai'
# 过期时间
# event_queue_ttl = 5
# celery不回复结果
task_ignore_result = False

# 为防止内存泄漏，一个进程执行过N次之后杀死，建议是100次
worker_max_tasks_per_child = 10
# 错误 DatabaseWrapper objects created in a thread can only be used in that same thread
CELERY_TASK_ALWAYS_EAGER = False

broker_connection_retry_on_startup = True
